<?php
include_once('getTrendingWords.php');

function createTrendingWordsFile(){
	
	$trendingWords = getTrendingWords();
	$file = 'frontend/trendingWordsView.php';
	cleanFile($file);
	
	for ($i = 0; $i < 18; $i++) {
		$trendingWords['words'][$i]=ucfirst($trendingWords['words'][$i]);
		$line = "\n" . "<div class='trendigWordsContainer' id='word$i'><a class='trendigWords' href='buscar.php?keyword=" .$trendingWords['words'][$i]. "&ordenamiento=peso'>" . $trendingWords['words'][$i]. "<br /></a>" . "</div>\n";
		file_put_contents($file, $line, FILE_APPEND | LOCK_EX);
	}
}

function cleanFile($file) {
	$empty = "";
	file_put_contents($file, $empty);
}

?>